package pers.cz.postgirl.adapter.http.servlet;

import pers.cz.postgirl.config.RecordPlayType;
import pers.cz.postgirl.util.ContextUtils;

/**
 * @program: postgirl-client
 * @description: Http插码逻辑处理
 * @author: Cheng Zhi
 * @create: 2023-06-07 11:55
 **/
public class HttpProcess {

    /**
     * Http插码
     * @param caseId 案例编码
     * @param type   录制 or 回放
     */
    public static void handle(String caseId, String type) {

        if (caseId != null && !caseId.isEmpty()) {

            ContextUtils.putCaseId(caseId);
            if (pers.cz.postgirl.config.RecordPlayType.RECORD.equals(type)) {
                System.out.println("当前操作为：录制");
                String key = RecordPlayType.RECORD;
                pers.cz.postgirl.util.ContextUtils.putEle(key, true);
            } else if (pers.cz.postgirl.config.RecordPlayType.PLAYBACK.equals(type)) {
                String key = RecordPlayType.PLAYBACK;
                System.out.println("当前操作为：回放");
                pers.cz.postgirl.util.ContextUtils.putEle(key, true);
            }
        }

    }
}
